package itqf.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * ${PACKAGE_NAME}
 * 2020/9/15
 */
@WebFilter(filterName = "EcodingFilter",value = "/*")
public class EcodingFilter implements Filter {
    public void destroy() {
    }

    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
        HttpServletRequest httpreq =(HttpServletRequest) req;
        httpreq.setCharacterEncoding("utf-8");
        chain.doFilter(httpreq, resp);
    }

    public void init(FilterConfig config) throws ServletException {

    }

}
